﻿using System;
using fastCSharp;
using diantou.examDataAccess;

namespace diantou.web.enterprise
{
    /// <summary>
    /// 话题题目集合
    /// </summary>
    [fastCSharp.code.cSharp.webView(IsPage = false, IsPool = true)]
    partial class topicProblem : examPermissionView<topicProblem>
    {
        /// <summary>
        /// 话题
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        private diantou.dataAccess.topic topic;
        /// <summary>
        /// 题目集合
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        private examProblem[] problems;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="page"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        private bool loadView(int topicId, int page, diantou.examDataAccess.examQuestion.sort sort, bool isAsc)
        {
            if (topicId == 0)
            {
                checkSearchEngine(null, webConfig.NotFound404);
                return false;
            }
            topic = diantou.dataAccess.tcpCall.topic.Get(topicId);
            if (topic != null)
            {
                examDataAccess.examProblem[] problems = clientCache.ExamProblem.Get(diantou.examDataAccess.tcpCall.examProblem.getIdsByTopic(topicId, currentUserId, sort, isAsc, pageInfo.Size = fastCSharp.config.pub.Default.PageSize, pageInfo.Page = page, out pageInfo.Count));
                this.problems = problems.getArray(problem => new examProblem { ExamId = 0, Problem = problem });
                return true;
            }
            AjaxResponse(webConfig.NotFound404);
            return false;
        }
    }
}
